package com.tom.exception;

import com.tom.constant.SystemConstant;

public enum CommonError {

    PARAM_INVALID(SystemConstant.PARAMETER_INVALID_CODE, "缺少必要參數"),

    OPERATE_PARAM_INVALID(SystemConstant.PARAMETER_INVALID_CODE, "操作類型不合法"),

    ARTICLE_PARAM_INVALID(SystemConstant.PARAMETER_INVALID_CODE, "文章參數列表不合法"),

    CAN_NOT_GET_ARTICLE(SystemConstant.CAN_NOT_GET_ARTICLE_CODE, "获取大网文章异常"),

    CAN_NOT_PRODUCE_ARTICLE_JSON(SystemConstant.CAN_NOT_PRODUCE_ARTICLE_JSON_CODE, "生成json文件失败"),

    CHANNEL_NOT_FOUND(SystemConstant.CHANNEL_NOT_FOUND_CODE, "无法找到对应的频道名称的频道id"),

    CAN_NOT_UPDATE_DATABASE(SystemConstant.CAN_NOT_UPDATE_DATABASE_COED, "数据库执行失败"),

    CAN_NOT_SAVE_ARTICLE_JSON(SystemConstant.CAN_NOT_SAVE_ARTICLE_JSON_COED, "保存json文件出错"),

    JOURNAL_INVALID(SystemConstant.JOURNAL_INVALID_CODE, "期刊號無效，請稍後重試"),

    TITLE_INVALID(SystemConstant.TITLE_INVALID_CODE, "文章標題無效，請稍後重試"),

    CONTEXT_INVALID(SystemConstant.CONTEXT_INVALID_CODE, "文章正文無效，請稍後重試"),

    FAIL(SystemConstant.FAIL_CODE, SystemConstant.FAIL_MSG),
    INSERT_ARTICLE_EXCEPTION(SystemConstant.INSERT_FAIL_CODE, "文章已經存在，新增失敗"),

    UPDATE_ARTICLE_EXCEPTION(SystemConstant.UPDATE_FAIL_CODE, "文章更新異常"),

    DELETE_ARTICLE_EXCEPTION(SystemConstant.DELETE_FAIL_CODE, "文章刪除異常"),

    INVALID_PUBLISH_TIME(SystemConstant.INVALID_PUBLISH_COED, "无效发布时间"),

    REMOTE_CALL(SystemConstant.REMOTE_CALL, "远程调用失败"),
    ;

    private final int code;
    private final String message;

    public int getCode() {
        return code;
    }

    public String getMessage() {
        return message;
    }

    CommonError(int code, String message) {
        this.code = code;
        this.message = message;
    }
}
